package com.yy.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Author young
 * Date 2022/12/27 16:25
 * Description: 自定义网关配置/=》不用yml配置的话就进行代码配置
 */
@Configuration
public class GatewayConfig {
 //   @Bean
    public RouteLocator mineRouteLocator(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
       //对4399网页自定义配置路由匹配规则
        routes.route("my_path_route1",
                r->r.path("/a1").uri("https://www.4399.com")).build();
        
        return routes.build();
    }
}
